<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%post}}".
 *
 * @property integer $id
 * @property integer $type
 * @property string $title
 * @property string $content
 * @property integer $hits
 * @property string $createat
 * @property string $updateat
 */
class Post extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%post}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [[ 'title', 'content'], 'required'],
            [[ 'hits'], 'integer'],
            [['content','type'], 'string'],
            [['createat', 'updateat'], 'safe'],
            [['title'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'type' => '分类',
            'title' => '标题',
            'content' => '内容',
            'hits' => 'Hits',
            'createat' => '时间',
            'updateat' => 'Updateat',
        ];
    }

    /**
     * @inheritdoc
     * @return PostQuery the active query used by this AR class.
     */
    public static function find()
    {
        return new PostQuery(get_called_class());
    }
}
